﻿<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
  <FieldType>
    <Field Name="TypeName">WindowsMediaPlayerField</Field>
    <Field Name="ParentType">URL</Field>
    <Field Name="TypeDisplayName">Windows Media Field</Field>
    <Field Name="UserCreatable">TRUE</Field>
    <Field Name="FieldTypeClass">
      Microsoft.SDK.SharePointServer.Samples.MediaPlayerField,
      MediaPlayerCustomFieldType,
      Version=1.0.0.0,
      Culture=neutral,
      PublicKeyToken=58e836163354fe82
    </Field>

    <!-- Possible RenderPatterns: HeaderPattern, DisplayPattern, EditPattern,
    NewPattern, PreviewDisplayPattern, PreviewEditPattern, PreviewNewPattern -->

    <RenderPattern Name="DisplayPattern">
      <!-- Display the media file url -->
      <Switch>
        <Expr>
          <Column/>
        </Expr>
        <Case Value="">
          <Column2 HTMLEncode="TRUE"/>
        </Case>
        <Default>
          <FieldSwitch>
            <Expr>
              <Property Select="Format"/>
            </Expr>
            <Case Value="Image">
              <FieldSwitch>
                <Expr>
                  <Property Select="Width"/>
                </Expr>
                <Case Value="">
                  <HTML><![CDATA[<IMG SRC="]]></HTML>
                  <Column HTMLEncode="TRUE"/>
                  <HTML>" ALT="</HTML>
                  <Column2 HTMLEncode="TRUE"/>
                  <HTML><![CDATA[">]]></HTML>
                </Case>
                <Default>
                  <HTML><![CDATA[<IMG SRC="]]></HTML>
                  <Column HTMLEncode="TRUE"/>
                  <HTML>" ALT="</HTML>
                  <Column2 HTMLEncode="TRUE"/>
                  <HTML><![CDATA[" WIDTH="]]></HTML>
                  <Property Select="Width"/>
                  <HTML><![CDATA[" HEIGHT="]]></HTML>
                  <Property Select="Height"/>
                  <HTML><![CDATA["> ]]></HTML>
                </Default>
              </FieldSwitch>
            </Case>
            <Default>
              <HTML><![CDATA[<A HREF="]]></HTML>
              <Column HTMLEncode="TRUE"/>
              <HTML><![CDATA[">]]></HTML>
              <Switch>
                <Expr>
                  <Column2/>
                </Expr>
                <Case Value="">
                  <Column HTMLEncode="TRUE"/>
                </Case>
                <Default>
                  <Column2 HTMLEncode="TRUE"/>
                </Default>
              </Switch>
              <HTML><![CDATA[</A>]]></HTML>
            </Default>
          </FieldSwitch>
        </Default>
      </Switch>
    </RenderPattern>

    <PropertySchema>
      <Fields>
        <Field Name="Height"
					   DisplayName="Height (in pixels)"
					   Type="Integer">
          <Default>300</Default>
        </Field>
        <Field Name="Width"
					   DisplayName="Width (in pixels)"
					   Type="Integer">
          <Default>400</Default>
        </Field>
        <Field Name="Autostart"
					   DisplayName="Automatically play the video"
					   Type="Boolean">
          <Default>false</Default>
        </Field>
        <Field Name="AllowExternalUrls"
					   DisplayName="Allow External Urls"
					   Type="Boolean">
          <Default>true</Default>
        </Field>
      </Fields>
    </PropertySchema>
  </FieldType>
</FieldTypes>